﻿#region Copyright information
// 
// Copyright © 2005-2013 Yongkee Cho. All rights reserved.
// 
// This code is a part of the Biological Object Library and governed under the terms of the
// GNU Lesser General  Public License (LGPL) version 2.1 which accompanies this distribution.
// For more information on the LGPL, please visit http://bol.codeplex.com/license.
// 
// - Filename: EspressoMachine.cs
// - Author: Yongkee Cho
// - Email: yongkeecho@gmail.com
// - Date Created: 2013-01-24 4:34 PM
// - Last Modified: 2013-01-25 3:59 PM
// 
#endregion
using System.Collections.Generic;

namespace BOL.Algorithms.StateMachines.Models
{
    /// <summary>
    /// Models an espresso machine.
    /// </summary>
    public class EspressoMachine : FiniteStateMachine<string, string>
    {
        public EspressoMachine()
            : base(
                new [] { "Off", "On", "EspressoReady", "MakeEspresso", "SteamerReady", "MakeSteamer" }, 
                new Dictionary<string, IDictionary<string, string>>
                {
                    { "Off", new Dictionary<string, string> { { "On", "SwitchOn"} } },
                    { "On", new Dictionary<string, string> { { "EspressoReady", "HeatUp"}, {"Off", "SwitchOff" } } },
                    { "EspressoReady", new Dictionary<string, string> { { "Off", "SwitchOff"}, {"SteamerReady", "SteamOn" }, {"MakeEspresso", "EspressoOn" } } },
                    { "SteamerReady", new Dictionary<string, string> { { "Off", "SwitchOff"}, {"MakeSteamer", "SteamKnobForward" }, {"EspressoReady", "SteamOff" } } },
                    { "MakeEspresso", new Dictionary<string, string> { { "EspressoReady", "EspressoOff"} } },
                    { "MakeSteamer", new Dictionary<string, string> { { "SteamerReady", "SteamKnobBackward"} } }
                }
            )
        {
        }
    }
}